<?php

/**
 * University filter form base class.
 *
 * @package    Amman to London
 * @subpackage filter
 * @author     Adel Abu-Saif <adeljas@msn.com>
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseUniversityFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name_en'       => new sfWidgetFormFilterInput(),
      'address_en'    => new sfWidgetFormFilterInput(),
      'name_ar'       => new sfWidgetFormFilterInput(),
      'address_ar'    => new sfWidgetFormFilterInput(),
      'telephone'     => new sfWidgetFormFilterInput(),
      'acronym'       => new sfWidgetFormFilterInput(),
      'business_type' => new sfWidgetFormChoice(array('choices' => array('' => '', 'by_course' => 'by_course', 'by_semester' => 'by_semester'))),
    ));

    $this->setValidators(array(
      'name_en'       => new sfValidatorPass(array('required' => false)),
      'address_en'    => new sfValidatorPass(array('required' => false)),
      'name_ar'       => new sfValidatorPass(array('required' => false)),
      'address_ar'    => new sfValidatorPass(array('required' => false)),
      'telephone'     => new sfValidatorPass(array('required' => false)),
      'acronym'       => new sfValidatorPass(array('required' => false)),
      'business_type' => new sfValidatorChoice(array('required' => false, 'choices' => array('by_course' => 'by_course', 'by_semester' => 'by_semester'))),
    ));

    $this->widgetSchema->setNameFormat('university_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'University';
  }

  public function getFields()
  {
    return array(
      'id'            => 'Number',
      'name_en'       => 'Text',
      'address_en'    => 'Text',
      'name_ar'       => 'Text',
      'address_ar'    => 'Text',
      'telephone'     => 'Text',
      'acronym'       => 'Text',
      'business_type' => 'Enum',
    );
  }
}
